package com.atchangsha.system.dto;



import com.atchangsha.system.entity.WorkerEntity;
import lombok.*;

import java.io.Serializable;

@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class WorkerDTO implements Serializable {
    /**
     * 员工号
     */
    private Long id;
    /**
     * 姓名
     */
    private String name;
    /**
     * 性别
     */
    private String sex;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 工资
     */
    private Float salary;
    /**
     * 账号
     */
    private String username;
    /**
     * 密码
     */
    private String password;
    /**
     * 绩效
     */
    private Long performance;
    /**
     * 手机号
     */
    private String phone;

    /**
     * 将DTO对象转换成entity对象
     *
     * @return entity对象
     */
    public WorkerEntity toEntity(){
        return WorkerEntity.builder()
                .id(id)
                .age(age)
                .name(name)
                .sex(sex)
                .salary(salary)
                .username(username)
                .password(password)
                .performance(performance)
                .phone(phone)
                .build();
    }
}
